<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>工程师分页页面</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="css/font.css">
    <link rel="stylesheet" href="css/xadmin.css">
    <script src="lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="js/xadmin.js"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="x-nav">
            <span class="layui-breadcrumb">
                <a href="">工程师首页</a>

            </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
    </a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <!--模糊查找-->
                    <form class="layui-form layui-col-space5">
                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="name" placeholder="姓名" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="goodat" placeholder="擅长" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <button class="layui-btn" lay-submit="" lay-filter="sreach">
                                <i class="layui-icon">&#xe615;</i></button>
                        </div>
                    </form>
                </div>
                <div class="layui-card-body ">
                    <table class="layui-table"
                           lay-data="{url:'./repairManserch',page:true,toolbar: '#toolbarDemo',id:'repair'}"
                           lay-filter="repair">
                        <thead>
                        <tr>
                            <th lay-data="{type:'radio'}">ID</th>
                            <th lay-data="{field:'name', width:80, sort: true}">姓名</th>
                            <th lay-data="{field:'goodat', width:120, sort: true}">擅长</th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/html" id="toolbarDemo">
</script>
<script>
    var gobj=null;
    layui.use(['table', 'layer', 'form'],
        function () {
            var table = layui.table;
            var layer = layui.layer;
            var $ = layui.$;
            var form = layui.form;
            form.on("submit(sreach)", function (data) {

                table.reload("repair", {
                    page: {
                        curr: 1
                        //重新从第 1 页开始
                    }, where: data.field
                });
                return false;
            });

            table.on('row(repair)', function (obj) {
                gobj=obj.data;
                console.log(JSON.stringify(gobj));
            });
        });</script>
<script>
    function  callbackdata() {
        if(gobj==null)
            return false;
        return gobj;
    }
</script>
</html>